#include <cstdio>
const int N = 1010;
int n, cnt;
int a[N];
bool check(int x) {
	for (int i = 2; i * i <= x; ++i) {
		if (x % i == 0) return false;
	}
	return true;
}
int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
	freopen("testdata.in", "r", stdin);
	freopen("testdata.out", "w", stdout);
#endif
#ifndef LOCAL
	freopen("prime.in", "r", stdin);
	freopen("prime.out", "w", stdout);
#endif
#endif

	scanf("%d", &n);
	for (int i = 1; i <= n; ++i) {
		scanf("%d", &a[i]);
		if (a[i] == 1) ++cnt;
	}
	int ans1 = 0, ans2 = 0;
	if (cnt >= 3) {
		for (int i = 1; i <= n; ++i) {
			if (a[i] != 1 && check(a[i] + 1))
				if (ans1 < a[i]) ans1 = a[i];
		}
		if (ans1) {
			printf("4\n1 1 1 %d", ans1);
		} else
			printf("3\n1 1 1");
	} else {
		for (int i = 1; i <= n; ++i) {
			for (int j = i + 1; j <= n; ++j) {
				if (check(a[i] + a[j])) {
					if ((ans1 + ans2) < (a[i] + a[j])) ans1 = a[i], ans2 = a[j];
				}
			}
		}
		printf("2\n%d %d", ans1, ans2);
	}
	return 0;
}